| 1 | From: Taylor, Jon (STFC,RAL,ISIS) |
|---|
| 2 | Sent: 11 January 2011 14:58 |
|---|
| 3 | To: Draper, Nick (-,RAL,ISIS) |
|---|
| 4 | Subject: RE: sofqw |
|---|
| 5 | |
|---|
| 6 | Follow Up Flag: Follow up |
|---|
| 7 | Flag Status: Flagged |
|---|
| 8 | |
|---|
| 9 | hi |
|---|
| 10 | the lamp routine is below, its in the lamp macro language... enjoy |
|---|
| 11 | cheers |
|---|
| 12 | Jon |
|---|
| 13 | ;----------------------------------------------------------------------------- |
|---|
| 14 | --- |
|---|
| 15 | ;***************************************************************************** |
|---|
| 16 | *** |
|---|
| 17 | ; |
|---|
| 18 | FUNCTION sqw_rebin, w_in, dQ = dQ, Emin = Emin0, all_angles = all_angles, $ |
|---|
| 19 | pos_angles = pos_angles, neg_angles = neg_angles, $ |
|---|
| 20 | swap_QE = swap_QE, qb, em, ib |
|---|
| 21 | ; |
|---|
| 22 | ; For IN4, IN5, IN6, BRISP and D7 |
|---|
| 23 | ; |
|---|
| 24 | ;rebins output data from t2e and reb to regular-grid S(Q,w) data using the old |
|---|
| 25 | ;KHA IN6 rebin algorithm. Proper rebionning routine with error analysis |
|---|
| 26 | (unlike |
|---|
| 27 | ;sqw_interp.pro). |
|---|
| 28 | ; |
|---|
| 29 | ;ARGUMENTS: |
|---|
| 30 | ; dQ : Q bin width |
|---|
| 31 | ; Emin0: Minimum energy value (meV) - neutron energy gain is negative |
|---|
| 32 | ; |
|---|
| 33 | ;KEYWORDS (- only for D7 data) |
|---|
| 34 | ; /neg_angles : use only negative angles |
|---|
| 35 | ; /pos_angles : use only positive angles |
|---|
| 36 | ; /all_angles : use all angles (default) |
|---|
| 37 | ; input workspace must be in energy transfer versus scattering angle, |
|---|
| 38 | ; i.e. only one component or spin phase. |
|---|
| 39 | ; (qb, em and ib are obsolete, kept for backwards compatibility) |
|---|
| 40 | ; |
|---|
| 41 | ;DIMENSIONS: |
|---|
| 42 | ; w_in(nE,nphi) -> w_out(nQs,nEs) |
|---|
| 43 | ; |
|---|
| 44 | ;COMMAND SYNTAX: |
|---|
| 45 | ; w10=spw_rebin(w9,dQ=<dQ>, |
|---|
| 46 | Emin=<Emin>[,/neg_angles][,/pos_angles][,/all_angles]) |
|---|
| 47 | ; |
|---|
| 48 | ; (optional keywords shown in square brackets) |
|---|
| 49 | ; |
|---|
| 50 | ; KHA,JRS 9/02/06 |
|---|
| 51 | ;----------------------------------------------------------------------------- |
|---|
| 52 | --- |
|---|
| 53 | ;***************************************************************************** |
|---|
| 54 | *** |
|---|
| 55 | common c_lamp_access, inst |
|---|
| 56 | common grid, Qmin, Qmax, Emin, Emax |
|---|
| 57 | iprint = 0 ; if iprint>0, show debugging messages |
|---|
| 58 | IF iprint THEN PRINT,'Start sqw_rebin:' |
|---|
| 59 | take_datp, datp |
|---|
| 60 | ibank = 2 |
|---|
| 61 | IF N_ELEMENTS(qb) GT 0 THEN dQ = qb |
|---|
| 62 | IF N_ELEMENTS(em) GT 0 THEN Emin = em |
|---|
| 63 | IF N_ELEMENTS(ib) GT 0 THEN ibank = ib |
|---|
| 64 | IF KEYWORD_SET(pos_angles) THEN ibank = 1 |
|---|
| 65 | IF KEYWORD_SET(neg_angles) THEN ibank = 0 |
|---|
| 66 | IF KEYWORD_SET(all_angles) THEN ibank = 2 |
|---|
| 67 | IF KEYWORD_SET(swap_QE) THEN swap_QE = 1 ELSE swap_QE = 0 |
|---|
| 68 | no_small = 0 |
|---|
| 69 | IF (datp.y(0) GT 10.) AND (inst EQ 'IN4') THEN BEGIN |
|---|
| 70 | no_small = 1 |
|---|
| 71 | PRINT, 'SQW_rebin: IN4 data without small angle bank' |
|---|
| 72 | ENDIF |
|---|
| 73 | ;----------------------------------------------------------------------------- |
|---|
| 74 | -- |
|---|
| 75 | ;Set up starting parameters |
|---|
| 76 | IF N_ELEMENTS(dQ) NE 1 THEN BEGIN |
|---|
| 77 | ii = WIDGET_MESSAGE('SQW_rebin: Error - dQ must be specified', /ERROR) |
|---|
| 78 | RETURN, w_in |
|---|
| 79 | ENDIF |
|---|
| 80 | |
|---|
| 81 | IF N_ELEMENTS(Emin0) NE 1 THEN Emin0=-1.E+10 |
|---|
| 82 | sw = SIZE(w_in) |
|---|
| 83 | IF iprint THEN PRINT,'SIZE(w_in) = ',sw |
|---|
| 84 | |
|---|
| 85 | IF sw(0) NE 2 THEN BEGIN |
|---|
| 86 | s = 'SQW_rebin: Error - input workspace must be 2-D: E vs. phi' |
|---|
| 87 | ii = WIDGET_MESSAGE(s, /ERROR) |
|---|
| 88 | RETURN, w_in |
|---|
| 89 | ENDIF |
|---|
| 90 | |
|---|
| 91 | nx = sw(1) |
|---|
| 92 | ny = sw(2) |
|---|
| 93 | IF iprint THEN PRINT,'nx=',nx,' ny=',ny |
|---|
| 94 | x_in = datp.x & sx = SIZE(x_in) |
|---|
| 95 | y_in = datp.y & sy = SIZE(y_in) |
|---|
| 96 | IF (nx NE sx(1)) OR (ny NE sy(1)) THEN BEGIN |
|---|
| 97 | s = 'SQW_rebin: sx = ' + STRTRIM(STRING(sx),2) + $ |
|---|
| 98 | ' sy = ' + STRTRIM(STRING(sy),2) |
|---|
| 99 | ii = WIDGET_MESSAGE(s, /ERROR) |
|---|
| 100 | RETURN, w_in |
|---|
| 101 | ENDIF |
|---|
| 102 | e_in = datp.e |
|---|
| 103 | se = SIZE(e_in) |
|---|
| 104 | IF (se(0) NE sw(0) OR se(1) NE sw(1) OR se(2) NE sw(2)) THEN e_in=w_in*0. |
|---|
| 105 | par=datp.p |
|---|
| 106 | IF iprint THEN PRINT,'Instrument = ',inst |
|---|
| 107 | IF (inst EQ 'D7') THEN lambda = par(4) ELSE lambda = par(21) |
|---|
| 108 | IF iprint THEN PRINT,'lambda = ',lambda,'A' |
|---|
| 109 | ;----------------------------------------------------------------------------- |
|---|
| 110 | -------- |
|---|
| 111 | ; Set constants and prepare arrays for rebinning to regular Q-E grid |
|---|
| 112 | const1 = 5.22697 ; E(meV) = const1*V(m/ms)^2 |
|---|
| 113 | const2 = 2.07193571 ; E(meV) = const2*k(A^-1)^2 |
|---|
| 114 | const3 = 3.956076 ; V(m/ms) = const3/lambda(A) |
|---|
| 115 | const4 = 81.8066 ; E(meV) = const4/lambda(A)^2 |
|---|
| 116 | Ei = const4 / lambda^2 |
|---|
| 117 | ki = SQRT(Ei / const2) |
|---|
| 118 | y_in = y_in*!pi/180. ; convert to radians |
|---|
| 119 | nEps = nx + 1 |
|---|
| 120 | Eps = FLTARR(nEps) |
|---|
| 121 | Eps(0) = x_in(0) - (x_in(1) - x_in(0)) / 2. |
|---|
| 122 | Eps(1:nx-1) = (x_in(0:nx - 2) + x_in(1:nx - 1)) / 2. |
|---|
| 123 | Eps(nx) = x_in(nx - 1) + (x_in(nx - 1) - x_in(nx - 2)) / 2. |
|---|
| 124 | iEarr = WHERE(x_in GT Emin0) |
|---|
| 125 | Eps = Eps(iEarr(0):nx) |
|---|
| 126 | nEps = nx - iEarr(0) + 1 |
|---|
| 127 | Emin = Eps(0) |
|---|
| 128 | Emax = Eps(nEps - 1) |
|---|
| 129 | Qmin = 0 |
|---|
| 130 | max_y = MAX(y_in) |
|---|
| 131 | Qmax = SQRT((2.*Ei - Emin - 2.*SQRT(Ei*(Ei - Emin))*COS(max_y))/const2) |
|---|
| 132 | Qmax=MAX([Qmax,ki]) |
|---|
| 133 | IF iprint THEN PRINT,'x = ',x_in |
|---|
| 134 | IF iprint THEN PRINT,'iEarr(0) = ',iEarr(0),' nx = ',nx |
|---|
| 135 | IF iprint THEN PRINT,'Emin = ',Emin,' Emax=',Emax,' meV' |
|---|
| 136 | IF iprint THEN PRINT,'Eps = ',Eps |
|---|
| 137 | IF iprint THEN PRINT,'SQW_rebin: E-array prepared' |
|---|
| 138 | ;----------------------------------------------------------------------------- |
|---|
| 139 | ;angle grid generation |
|---|
| 140 | nQ = FIX((Qmax - Qmin) / dQ) + 1 |
|---|
| 141 | w_out = FLTARR(nQ,nEps) |
|---|
| 142 | e_out = w_out - 1. |
|---|
| 143 | Q = Qmin + FLOAT(INDGEN(nQ))*dQ |
|---|
| 144 | IF iprint THEN PRINT,'Qmin = ', Qmin |
|---|
| 145 | IF iprint THEN PRINT,'Qmax = ', Qmax |
|---|
| 146 | IF iprint THEN PRINT,'nQ = ', nQ |
|---|
| 147 | IF iprint THEN PRINT,'Q = ', Q |
|---|
| 148 | IF iprint THEN PRINT,'y_in = ', y_in*180./!pi |
|---|
| 149 | IF inst EQ 'D7' THEN BEGIN |
|---|
| 150 | isort = SORT(y_in) |
|---|
| 151 | y_buf1 = y_in(isort) |
|---|
| 152 | w_buf1 = w_in(*,isort) |
|---|
| 153 | e_buf1 = e_in(*,isort) |
|---|
| 154 | i = WHERE(y_buf1 GT 0.,n) |
|---|
| 155 | |
|---|
| 156 | IF ibank EQ 2 THEN BEGIN |
|---|
| 157 | twice = 1 |
|---|
| 158 | iphi1 = 0 & iphi1next = i(0) |
|---|
| 159 | iphi2 = i(0) - 1 & iphi2next = ny - 1 |
|---|
| 160 | ENDIF ELSE BEGIN |
|---|
| 161 | twice = 0 |
|---|
| 162 | IF ibank EQ 0 THEN BEGIN |
|---|
| 163 | iphi1 = 0 |
|---|
| 164 | iphi2 = i(0) - 1 |
|---|
| 165 | ENDIF ELSE IF ibank EQ 1 THEN BEGIN |
|---|
| 166 | iphi1 = i(0) |
|---|
| 167 | iphi2 = ny - 1 |
|---|
| 168 | ENDIF |
|---|
| 169 | ENDELSE |
|---|
| 170 | ENDIF ELSE BEGIN |
|---|
| 171 | twice = 0 |
|---|
| 172 | iphi1 = 0 & iphi2 = ny - 1 |
|---|
| 173 | ENDELSE |
|---|
| 174 | IF iprint THEN PRINT,'twice=',twice,' iphi1=',iphi1,' iphi2=',iphi2 |
|---|
| 175 | start: |
|---|
| 176 | IF inst EQ 'D7' THEN BEGIN |
|---|
| 177 | nphi = iphi2 - iphi1 + 2 |
|---|
| 178 | phi = FLTARR(nphi) |
|---|
| 179 | phi(0) = y_buf1(iphi1) - (y_buf1(iphi1 + 1) - y_buf1(iphi1)) / 2. |
|---|
| 180 | phi(1:nphi-2) = (y_buf1(iphi1:iphi2 - 1) + y_buf1(iphi1 + 1:iphi2)) / 2. |
|---|
| 181 | phi(nphi-1) = y_buf1(iphi2) + (y_buf1(iphi2) - y_buf1(iphi2 - 1))/2. |
|---|
| 182 | w_buf = w_buf1(iEarr,iphi1:iphi2) |
|---|
| 183 | e_buf = e_buf1(iEarr,iphi1:iphi2) |
|---|
| 184 | y_buf = y_buf1(iphi1:iphi2) |
|---|
| 185 | ENDIF ELSE IF (inst EQ 'IN4') AND (NOT no_small) THEN BEGIN |
|---|
| 186 | nphi = ny+2 |
|---|
| 187 | phi = FLTARR(nphi) |
|---|
| 188 | IF iprint THEN PRINT,'y_in=',y_in*180./!pi |
|---|
| 189 | i1=(WHERE(y_in GT 10.*!pi/180.))(0)-1 |
|---|
| 190 | phi(0) = y_in(0) - (y_in(1) - y_in(0)) / 2. |
|---|
| 191 | phi(1:i1) = (y_in(0:i1-1)+y_in(1:i1))/2. |
|---|
| 192 | phi(i1+1) = phi(i1)+(y_in(i1)-y_in(i1-1)) |
|---|
| 193 | phi(i1+3:nphi-2) = (y_in(i1+1:ny-2)+y_in(i1+2:ny-1))/2. |
|---|
| 194 | phi(i1+2) = phi(i1+3)-(y_in(i1+2)-y_in(i1+1)) |
|---|
| 195 | phi(nphi-1) = phi(nphi-2)+(y_in(ny-1)-y_in(ny-2)) |
|---|
| 196 | w_buf = [[w_in(iEarr,0:i1)],[0.*iEarr],[w_in(iEarr,i1+1:ny-1)]] |
|---|
| 197 | e_buf = [[e_in(iEarr,0:i1)],[0.*iEarr-1.],[e_in(iEarr,i1+1:ny-1)]] |
|---|
| 198 | y_buf = (phi(0:nphi-2)+phi(1:nphi-1))/2. |
|---|
| 199 | IF iprint THEN PRINT,' phi =',phi*180./!pi |
|---|
| 200 | IF iprint THEN FOR i=0,50 DO PRINT, i, phi(i)*180./!pi, y_in(i)*180./!pi |
|---|
| 201 | ENDIF ELSE BEGIN |
|---|
| 202 | nphi = iphi2 - iphi1 + 2 |
|---|
| 203 | phi = FLTARR(nphi) |
|---|
| 204 | phi(0) = y_in(iphi1) - (y_in(iphi1 + 1) - y_in(iphi1)) / 2. |
|---|
| 205 | phi(1:nphi-2) = (y_in(iphi1:iphi2 - 1) + y_in(iphi1 + 1:iphi2)) / 2. |
|---|
| 206 | phi(nphi-1) = y_in(iphi2) + (y_in(iphi2) - y_in(iphi2 - 1))/2. |
|---|
| 207 | w_buf = w_in(iEarr,iphi1:iphi2) |
|---|
| 208 | e_buf = e_in(iEarr,iphi1:iphi2) |
|---|
| 209 | y_buf = y_in(iphi1:iphi2) |
|---|
| 210 | ENDELSE |
|---|
| 211 | COSphi = COS(phi) |
|---|
| 212 | |
|---|
| 213 | ; reverse array direction for negative angles |
|---|
| 214 | IF phi(0) LT 0. THEN BEGIN |
|---|
| 215 | w_buf = REVERSE(w_buf,2) |
|---|
| 216 | e_buf = REVERSE(e_buf,2) |
|---|
| 217 | y_buf = ABS(REVERSE(y_buf)) |
|---|
| 218 | phi = ABS(REVERSE(phi)) |
|---|
| 219 | COSphi= REVERSE(COSphi) |
|---|
| 220 | ENDIF |
|---|
| 221 | IF iprint THEN PRINT,'phi=',phi*180./!pi |
|---|
| 222 | IF iprint THEN PRINT,'End of "prepare angle arrays" section' |
|---|
| 223 | ;----------------------------------------------------------------------------- |
|---|
| 224 | -------- |
|---|
| 225 | ; Rebin angles to constant Q grid |
|---|
| 226 | a = const2 ; E(meV)=a*Q(A**-1)**2 |
|---|
| 227 | iprint0 = iprint |
|---|
| 228 | oldymin = 0. |
|---|
| 229 | IF iprint THEN BEGIN |
|---|
| 230 | b='' |
|---|
| 231 | PRINT,'About to start rebinning. Hit return to continue' |
|---|
| 232 | READ, b |
|---|
| 233 | ENDIF |
|---|
| 234 | FOR iQ = 0,nQ - 1 DO BEGIN |
|---|
| 235 | Qmin = Q(iQ) - (dQ / 2.) |
|---|
| 236 | Qmax = Q(iQ) + (dQ / 2.) |
|---|
| 237 | Q00 = [Qmin, Qmin, Qmax, Qmax] |
|---|
| 238 | FOR iEps = 0, nEps - 2 DO BEGIN |
|---|
| 239 | Emin = Eps(iEps) |
|---|
| 240 | Emax = Eps(iEps + 1) |
|---|
| 241 | corrarea = dQ*(Emax - Emin) |
|---|
| 242 | Eps0 = [Emin, Emax, Emax, Emin] |
|---|
| 243 | COSphi0 = (2.*Ei - Eps0 - a*Q00^2) / (2.*SQRT(Ei*(Ei - Eps0))) |
|---|
| 244 | IF MAX(ABS(COSphi0)) GE 1. THEN GOTO, outside |
|---|
| 245 | phi0 = ACOS(COSphi0) |
|---|
| 246 | phimin = MIN(phi0) |
|---|
| 247 | phimax = MAX(phi0) |
|---|
| 248 | IF (phimax LT phi(0)) OR (phimin GT phi(nphi-1)) THEN GOTO, outside |
|---|
| 249 | iphi = WHERE(phi GT phimin AND phi LT phimax, nlines) |
|---|
| 250 | iphi0 = (iphi(0) - 1) > 0 |
|---|
| 251 | IF nlines EQ 0 THEN BEGIN |
|---|
| 252 | phimean = (phimin + phimax) / 2. |
|---|
| 253 | ip = WHERE(phi LT phimean, np) |
|---|
| 254 | iphi0 = ip(np - 1) |
|---|
| 255 | ENDIF |
|---|
| 256 | startrebin: Areasum = 0. |
|---|
| 257 | wsum = 0. |
|---|
| 258 | e2sum = 0. |
|---|
| 259 | phiminmeas = 7. |
|---|
| 260 | phimaxmeas = 0. |
|---|
| 261 | FOR iphi = iphi0,(iphi0 + nlines) < (nphi - 2) DO BEGIN |
|---|
| 262 | COSphi1 = COSphi(iphi) |
|---|
| 263 | COSphi2 = COSphi(iphi + 1) |
|---|
| 264 | COSphi0 = [COSphi1, COSphi1, COSphi2, COSphi2] |
|---|
| 265 | Q0 = SQRT((2.*Ei - Eps0 - 2.*SQRT(Ei*(Ei - Eps0))*COSphi0)/a) |
|---|
| 266 | area = OVERLAP(Q0, Eps0, iprint, oldymin) |
|---|
| 267 | IF area GT 0. THEN BEGIN |
|---|
| 268 | w = w_buf(iEps,iphi) |
|---|
| 269 | e = e_buf(iEps,iphi) |
|---|
| 270 | IF (w NE 0.) OR (e GE 0.) THEN BEGIN |
|---|
| 271 | areasum = areasum + area |
|---|
| 272 | wsum = wsum + area*w |
|---|
| 273 | e2sum = e2sum + (area*e)^2 |
|---|
| 274 | phiminmeas = phiminmeas < phi(iphi) |
|---|
| 275 | phimaxmeas = phimaxmeas > phi(iphi + 1) |
|---|
| 276 | ENDIF |
|---|
| 277 | ENDIF |
|---|
| 278 | ENDFOR |
|---|
| 279 | IF areasum NE 0. THEN BEGIN |
|---|
| 280 | w_out(iQ,iEps) = wsum / areasum |
|---|
| 281 | e_out(iQ,iEps) = SQRT(e2sum) / areasum |
|---|
| 282 | GOTO, binned |
|---|
| 283 | ENDIF |
|---|
| 284 | outside: w_out(iQ,iEps) = 0. |
|---|
| 285 | e_out(iQ,iEps) = -1. |
|---|
| 286 | GOTO, nextpoint |
|---|
| 287 | binned: |
|---|
| 288 | p1 = phimin > phiminmeas |
|---|
| 289 | p2 = phimax < phimaxmeas |
|---|
| 290 | IF p2 - p1 LT (phimax - phimin)/2. THEN BEGIN |
|---|
| 291 | w_out(iQ,iEps) = 0. |
|---|
| 292 | e_out(iQ,iEps) = -1. |
|---|
| 293 | ENDIF |
|---|
| 294 | nextpoint: |
|---|
| 295 | ENDFOR |
|---|
| 296 | ENDFOR |
|---|
| 297 | iprint = iprint0 |
|---|
| 298 | IF iprint THEN PRINT,'End of rebinning' |
|---|
| 299 | IF twice THEN BEGIN |
|---|
| 300 | IF (iphi1 EQ 0) THEN BEGIN |
|---|
| 301 | w_out1 = w_out |
|---|
| 302 | e_out1 = e_out |
|---|
| 303 | iphi1 = iphi1next |
|---|
| 304 | iphi2 = iphi2next |
|---|
| 305 | GOTO, start |
|---|
| 306 | ENDIF ELSE BEGIN |
|---|
| 307 | ;take weighted averages of negative and positive banks for D7 |
|---|
| 308 | w_out2 = w_out |
|---|
| 309 | e_out2 = e_out |
|---|
| 310 | w_out = 0. |
|---|
| 311 | e_out = 0. |
|---|
| 312 | not1 = WHERE(e_out1 LE 0.,n1) |
|---|
| 313 | IF n1 NE 0 THEN e_out1(not1) = 1. |
|---|
| 314 | not2 = WHERE(e_out2 LE 0.,n2) |
|---|
| 315 | IF n2 NE 0 THEN e_out2(not2) = 1. |
|---|
| 316 | w_out = (w_out1/e_out1^2 + w_out2/e_out2^2) / (1./e_out1^2 + 1./e_out2^2) |
|---|
| 317 | e_out = 1./SQRT(1./e_out1^2 + 1./e_out2^2) |
|---|
| 318 | IF n1 NE 0 THEN e_out1(not1) = -1. |
|---|
| 319 | IF n2 NE 0 THEN e_out2(not2) = -1. |
|---|
| 320 | IF n1 NE 0 THEN BEGIN |
|---|
| 321 | w_out(not1) = w_out2(not1) |
|---|
| 322 | e_out(not1) = e_out2(not1) |
|---|
| 323 | ENDIF |
|---|
| 324 | IF n2 NE 0 THEN BEGIN |
|---|
| 325 | w_out(not2) = w_out1(not2) |
|---|
| 326 | e_out(not2) = e_out1(not2) |
|---|
| 327 | ENDIF |
|---|
| 328 | ENDELSE |
|---|
| 329 | ENDIF |
|---|
| 330 | IF iprint THEN PRINT,'End of rebinning section' |
|---|
| 331 | ;----------------------------------------------------------------------------- |
|---|
| 332 | -------- |
|---|
| 333 | ;Chop off superfluous bits |
|---|
| 334 | i = WHERE(e_out GT -1.,n) |
|---|
| 335 | IF iprint THEN PRINT, n, ' non-zeroed points' |
|---|
| 336 | checkQ2: |
|---|
| 337 | iw0 = WHERE(w_out(nQ - 1,*) EQ 0., nw0) |
|---|
| 338 | ie0 = WHERE(e_out(nQ - 1,*) EQ -1., ne0) |
|---|
| 339 | IF (nw0 EQ nEps) AND (ne0 EQ nEps) THEN BEGIN |
|---|
| 340 | nQ = nQ - 1 |
|---|
| 341 | w_out = w_out(0:nQ - 1,*) |
|---|
| 342 | e_out = e_out(0:nQ - 1,*) |
|---|
| 343 | Q = Q(0:nQ - 1) |
|---|
| 344 | GOTO, checkQ2 |
|---|
| 345 | ENDIF |
|---|
| 346 | checkEps1: |
|---|
| 347 | iw0 = WHERE(w_out(*,0) EQ 0., nw0) |
|---|
| 348 | ie0 = WHERE(e_out(*,0) EQ -1., ne0) |
|---|
| 349 | IF (nw0 EQ nQ) AND (ne0 EQ nQ) THEN BEGIN |
|---|
| 350 | nEps = nEps - 1 |
|---|
| 351 | w_out = w_out(*,1:nEps) |
|---|
| 352 | e_out = e_out(*,1:nEps) |
|---|
| 353 | Eps = Eps(1:nEps) |
|---|
| 354 | GOTO, checkEps1 |
|---|
| 355 | ENDIF |
|---|
| 356 | checkEps2: |
|---|
| 357 | iw0 = WHERE(w_out(*,nEps - 1) EQ 0., nw0) |
|---|
| 358 | ie0 = WHERE(e_out(*,nEps - 1) EQ -1., ne0) |
|---|
| 359 | IF (nw0 EQ nQ) AND (ne0 EQ nQ) THEN BEGIN |
|---|
| 360 | nEps = nEps - 1 |
|---|
| 361 | w_out = w_out(*,0:nEps - 1) |
|---|
| 362 | e_out = e_out(*,0:nEps - 1) |
|---|
| 363 | Eps = Eps(0:nEps - 1) |
|---|
| 364 | GOTO, checkEps2 |
|---|
| 365 | ENDIF |
|---|
| 366 | IF iprint THEN PRINT,'End of chopping section' |
|---|
| 367 | ;----------------------------------------------------------------------------- |
|---|
| 368 | -------- |
|---|
| 369 | ;Return parameters and exit |
|---|
| 370 | IF NOT swap_QE THEN BEGIN |
|---|
| 371 | datp.y_tit = datp.x_tit |
|---|
| 372 | datp.x_tit = 'Wavevector Transfer (A!U-1!N)' |
|---|
| 373 | MOD_DATP, datp, "x", Q |
|---|
| 374 | MOD_DATP, datp, "y", x_in(iEarr) |
|---|
| 375 | ENDIF ELSE BEGIN |
|---|
| 376 | w_out = TRANSPOSE(w_out) |
|---|
| 377 | e_out = TRANSPOSE(e_out) |
|---|
| 378 | datp.y_tit = 'Wavevector Transfer (A!U-1!N)' |
|---|
| 379 | MOD_DATP, datp, "x", x_in(iEarr) |
|---|
| 380 | MOD_DATP, datp, "y", Q |
|---|
| 381 | ENDELSE |
|---|
| 382 | MOD_DATP, datp, "e", e_out |
|---|
| 383 | PRINT, FORMAT = '("Sqw_Rebin: Rebinned to constant Q-w: dQ=",F4.2," A-1")', |
|---|
| 384 | dQ |
|---|
| 385 | s = STRTRIM(STRING(FLOAT(dQ)),2) & dQ = string_round(s) |
|---|
| 386 | s = ' -sr(dQ=' + dQ |
|---|
| 387 | IF Emin0 GT -9.E+09 THEN BEGIN |
|---|
| 388 | Emin = STRTRIM(STRING(FIX(Emin0)),2) |
|---|
| 389 | s = s + ',emin='+Emin |
|---|
| 390 | ENDIF |
|---|
| 391 | CASE ibank OF |
|---|
| 392 | 0: bs = '/neg)' |
|---|
| 393 | 1: bs = '/pos)' |
|---|
| 394 | 2: bs = '/all)' |
|---|
| 395 | ENDCASE |
|---|
| 396 | IF inst EQ 'D7' THEN s = s + bs ELSE s = s + ')' |
|---|
| 397 | datp.other_tit = datp.other_tit + s |
|---|
| 398 | GIVE_DATP, datp |
|---|
| 399 | finished: |
|---|
| 400 | RETURN, w_out |
|---|
| 401 | END |
|---|
| 402 | |
|---|
| 403 | ________________________________________ |
|---|
| 404 | From: Draper, Nick (-,RAL,ISIS) [nick.draper@stfc.ac.uk] |
|---|
| 405 | Sent: 11 January 2011 13:34 |
|---|
| 406 | To: Taylor, Jon (STFC,RAL,ISIS) |
|---|
| 407 | Subject: RE: sofqw |
|---|
| 408 | Jon, |
|---|
| 409 | Thanks for this. I was right on the phone when I said that this had been |
|---|
| 410 | created for indirect instruments where they have so much less data that it is |
|---|
| 411 | hard to spot any effect of this bug. |
|---|
| 412 | I'll raise a ticket to look at the lack of curvature on the lower boundary |
|---|
| 413 | (http://trac.mantidproject.org/mantid/ticket/2214). If you can drag anything |
|---|
| 414 | out from lamp that would be appreciated for the rebinning. |
|---|
| 415 | For swapping the axes you could try the Transpose algorithm. |
|---|
| 416 | Regards, |
|---|
| 417 | Nick Draper |
|---|
| 418 | |
|---|
| 419 | -----Original Message----- |
|---|
| 420 | From: Taylor, Jon (STFC,RAL,ISIS) |
|---|
| 421 | Sent: 11 January 2011 11:39 |
|---|
| 422 | To: Draper, Nick (-,RAL,ISIS) |
|---|
| 423 | Subject: sofqw |
|---|
| 424 | hi |
|---|
| 425 | I've attached a pic of what mslice produces for modQ for MARI and the output |
|---|
| 426 | from the sofqw algorithm. at low Q one should see a curved trajectory for the |
|---|
| 427 | detector group rather than a horizontal one. |
|---|
| 428 | Do you know if its possible to rotate the axis in mantid plot (a minor niggle) |
|---|
| 429 | the rebin is a finer correction as for a fist approximation a simple rebin |
|---|
| 430 | works OKish i will dig the ILL code from lamp out which does the full |
|---|
| 431 | treatment. |
|---|
| 432 | cheers |
|---|
| 433 | jon |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | ________________________________________ |
|---|
| 437 | From: Draper, Nick (-,RAL,ISIS) [nick.draper@stfc.ac.uk] |
|---|
| 438 | Sent: 11 January 2011 13:34 |
|---|
| 439 | To: Taylor, Jon (STFC,RAL,ISIS) |
|---|
| 440 | Subject: RE: sofqw |
|---|
| 441 | |
|---|
| 442 | Jon, |
|---|
| 443 | |
|---|
| 444 | Thanks for this. I was right on the phone when I said that this had been |
|---|
| 445 | created for indirect instruments where they have so much less data that it is |
|---|
| 446 | hard to spot any effect of this bug. |
|---|
| 447 | |
|---|
| 448 | I'll raise a ticket to look at the lack of curvature on the lower boundary |
|---|
| 449 | (http://trac.mantidproject.org/mantid/ticket/2214). If you can drag anything |
|---|
| 450 | out from lamp that would be appreciated for the rebinning. |
|---|
| 451 | |
|---|
| 452 | For swapping the axes you could try the Transpose algorithm. |
|---|
| 453 | |
|---|
| 454 | Regards, |
|---|
| 455 | Nick Draper |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | -----Original Message----- |
|---|
| 459 | From: Taylor, Jon (STFC,RAL,ISIS) |
|---|
| 460 | Sent: 11 January 2011 11:39 |
|---|
| 461 | To: Draper, Nick (-,RAL,ISIS) |
|---|
| 462 | Subject: sofqw |
|---|
| 463 | |
|---|
| 464 | hi |
|---|
| 465 | I've attached a pic of what mslice produces for modQ for MARI and the output |
|---|
| 466 | from the sofqw algorithm. at low Q one should see a curved trajectory for the |
|---|
| 467 | detector group rather than a horizontal one. |
|---|
| 468 | Do you know if its possible to rotate the axis in mantid plot (a minor niggle) |
|---|
| 469 | the rebin is a finer correction as for a fist approximation a simple rebin |
|---|
| 470 | works OKish i will dig the ILL code from lamp out which does the full |
|---|
| 471 | treatment. |
|---|
| 472 | cheers |
|---|
| 473 | jon |
|---|